//
//  PrivateSettingViewController.m
//  Arts1
//
//  Created by 孤星晨宇 on 15/10/15.
//  Copyright © 2015年 Arts1. All rights reserved.
//

#import "PrivateSettingViewController.h"

@interface PrivateSettingViewController ()<UITextFieldDelegate>

@end

@implementation PrivateSettingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBar.hidden = NO;
    // Do any additional setup after loading the view from its nib.
    
    [self modifySubView];
}

- (void)modifySubView{
    
    _cancel.layer.cornerRadius = 4;
    _cancel.layer.masksToBounds = YES;
    [_cancel addTarget:self action:@selector(cancel:) forControlEvents:(UIControlEventTouchUpInside)];
    
    _store.layer.cornerRadius = 4;
    _store.layer.masksToBounds = YES;
    [_store addTarget:self action:@selector(store:) forControlEvents:(UIControlEventTouchUpInside)];
    
    _mainTitle.text = _str;
    _message.delegate = self;
    
}

- (void)cancel:(UIButton *)btn{
    _mainTitle.text = nil;
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)store:(UIButton *)btn{

    if (_privateSettingBlock) {
        _privateSettingBlock(_message.text);
    }
    self.navigationController.navigationBar.hidden = NO;
    [self.navigationController popViewControllerAnimated:YES];
}

// 触摸空白区域取消编辑
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    [self.view endEditing:YES];
}

//
- (BOOL)textFieldShouldReturn:(UITextField *)textField{
    [self.view resignFirstResponder];
    return YES;
}




- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
